import { getSuggestsAPI } from '@/api/search';
import { AppDispatch } from '..';

export const getSuggestsAction = (q: string) => {
  return async (dispatch: AppDispatch) => {
    const res = await getSuggestsAPI(q);
    // 3. dispatch触发action
    dispatch({ type: 'search/saveSuggests', payload: res.data.options });
  };
};
